Linux Floobydust

Copyright (c) 2011 Dimitri Marinakis

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Table of Contents

Introduction

History

Acknowledgements

References

Disclaimer

Linux applications

GNOME Desktop Autostart

Firefox - disable uninitiated and unintended requests

Allow desktop access to other local users

Decode/encode base64 files

Wireless adapters – ndiswrapper

Camera access

Midnight Commander file manager – zip file issue

Find files modified today

Formatted table of contents

Floppy disk directory listing

CD disk directory listing

CD Directory tree

Change directory – file mode

Change file date and time

PCTel modem

Remove control characters from files

Poor man's concordance

Count lines and words

Convert doc files to txt

Remove zero bytes from the input file

Remove empty paragraphs

Find ASCII files

Convert filenames from one encoding to another

Change filenames to lower case

Change filenames to upper case

Crypto file system

Compare directories

Compare directory structures (file systems)

Video conversions

Use a computer as a gateway to the Internet

Deploy a system on a bunch of new computers

Search files for a pattern

Inter-process communications (IPC)

Image and pdf conversions

Infra-red port (Toshiba Satellite 1800)

GPRS info for various networks, Linux

Print using gs

Completely overwrite and delete files

Completely overwrite 720kb floppy

Completely overwrite 1.4Mb floppy

Completely overwrite device USB etc.

Collect system information

Use a CDRW with GRUB

GRUB examples

UPS

References, programming, other

Saving web pages

Multi-serial ports

Serial printer under KDE

Terratec sound card

Hellenic Polytonic keyboard

Run from flash (ramdisk)

GNU Free Documentation License

Introduction

This is collection of GNU/Linux ancient and newer information, tips, one-timers, and short shell programs (financiers, go away), in one place for easy reference. Scripts that include $1, $2 etc. parameters are meant to be copied to a file, made executable and run.

History

20111211 – first release: tlgu.carmen.gr

20111213 – additions

20111225 – more additions


Acknowledgements

Bob Pease (RAP) and Jim Williams for offering a good deal of their experience to the world; still shocked over the news of their passing earlier this year; farewell and thanks for all the floobydust!

All authors and contributors to the programs and scripts.

References

man is your friend

Disclaimer

The usual disclaimer about misconfiguring your system beyond repair or oblueterating your work applies: Don't blame it on us. Do one thing at a time. Make sure you understand the steps involved by reading the respective command manuals. Write to tlgu, carmen gr, in case this document contains inaccuracies, errors or if you have some information that others can benefit from.

Linux applications

This is a brief guide for installing and updating the PCLINUXOS GNU/Linux distribution, as well as a selection of applications to do useful work. Feel free to point out any “killer” application to replace or complement the listed ones.

Boot
Before you start – If you get the following error
ISOLINUX...
gfboot:
Could not detect available memory size
boot:
Answer with LiveCD_sata_probe [2007-2009 edition] or LiveCD [2010 edition], in order to load the corresponding image from the Live CD.

Install PCLINUXOS
If your computer is equipped with an mga based graphics card it may boot to a text screen (display manager does not start) or screen artifacts are visible.  
localhost login: root
Password: root
using vi or mc open /etc/X11/xorg.conf for editing
[2010] you can open the file using the file manager -
you must be root
Section "Device"
...
Driver "mga"
VideoRam 8128
...
Comment out the VideoRam specification:
Section "Device"
...
Driver "mga"
# VideoRam 8128
...
Start the X server, if you feel comfortable with it:
# init 3 (full system, network interface, no X)
# init 5 (full system, X server)
[2010] Log out, restart X server from the menu
(normally, X server is restarted automatically on log
out). No more artifacts.  This procedure should be repeated after the system is booted from the hard disk. Also, in the Monitor section of /etc/X11/xorg.conf add Option “DPMS” and delete any automatically inserted Modelines. 

… Now we can continue the installation …
Network configuration
Start the pclinuxos control center
System -> Configuration -> Configure your computer -> Set up network interface

Application list update
Start synaptic package manager
Reload (to read all package updates)
Mark All Upgrades
Apply

Application package installation
 ------------------------------------------------------------
| For a basic office (and more) computer,                    | 
| after this process is finished, add the following packages |
| with synaptic, if not already installed                    |
 ------------------------------------------------------------
antiword: word to text converter
webcore-fonts: fonts for compatibility with gatesware-documents
mc: midnight commander - command-line file manager like Norton commander – see note on zip files
gzip: file compression tools
zip: file compression tools
unzip: file compression tools
p7zip: file compression tools
rar: file compression tools
unrar: file compression tools
rarlinux: file compression tools
gimp: graphics manipulation program
gimp addons: as required
firefox (3/4): internet browsers – see note on firefox
iron-browser: internet browser (like chrome, but does not send data to google!)
lynx: internet browser (text) also used by mc
swfdec-mozilla: browser plugin (plays flash - may remove flash-player-plugin)
flash-player-plugin: browser plugin
djvulibre-plugin: browser plugin for rendering deja-view compressed documents
djvulibre: stand-alone program for rendering deja-view compressed documents
AdobeReader: pdf reader
AdobeReader-plugin: browser plugin
(xpdf: pdf reader)
(xpdf-tools: pdf processing tools)
gv: postscript (ps) renderer
koffice: various office tools (may not be needed - see below)
gkrellm: system monitors
gkrellm plugins: as required
sylpheed or claws: e-mail client
evolution: e-mail client
mozilla thunderbird: e-mail client
kdepim-kmail: kde e-mail client
k3b: cd and dvd burning tool front-end
cdparanoia: rip audio cds
libdvdcss2: read dvds
kdiff3: directory and file difference comparison
kdemultimedia: (packages may already be installed individually)
kdegraphics: graphics applications (packages may already be installed individually)
kdegraphics-kfax: for displaying multi-page fax documents
kdenetwork: networking applications
kdegraphics-kuickshow: fast image display program
ImageMagick: image display and conversion tool (the main program is called display)
kdeutils-kcalc: scientific calculator, ark: compressed file and archive manager
cups-pdf: pdf writer for cups (common unix printing system)
cups-drivers: printer drivers
mplayer: movie player
mplayer-gui
mplayerplugin: browser plugin
win32-codecs-all: movie player codecs
vlc: video lan - movie player and streamer
smb4k: to work with smb (gatesware) networks; also use smb:// ioslave with konqueror browser
locales-el: hellenic locale information

wv: word to html converter
xmms: music player (libvisual-plugins should be marked manually - pclinuxos 2011.6)
ntfsprogs: ntfs file system
ntfs-3g: ntfs filesystem driver with read-write support
minicom: serial terminal
gtkterm: serial terminal
moserial: serial terminal with hex input/output
nmap: network exploration tool
nmap-frontend
wireshark: network analysis tool
clipart-openclipart: LARGE file with clip art (install later, as needed)

also:
evolution, skype, kopete, azureus, amule,google earth, scribus, dvd creation programs and more.

 -----------------------------------------------------
| Programming                                         |
 -----------------------------------------------------
man-pages
gcc
gcc-c++
gccmakedep
glibc
glibc-headers-devel
glibc-utils
makedepend
cmake
gccmakedep
wxgtk2.8
strace

 -----------------------------------------------------
| Games                                               |
 -----------------------------------------------------
foobillard: billiards, 3D
frozen-bubble

 -----------------------------------------------------
| Emulators                                           |
 -----------------------------------------------------
wine: windows emulator (configurable windows versions)
wine-gecko: for "embedded IE"
winetricks: redistributable libraries
dosbox: dos emulator

 ------------------------------------------------------------
| Download and install the following Office programs         |
| from their repositories, Check out / download openoffice   |
| dictionaries, extensions (e.g. sun-pdfimport)              |
 ------------------------------------------------------------
 
 OpenOffice (currently by Apache)
 LibreOffice (the community version of OpenOffice)
 
 ------------------------------------------------------------
| Hellenic keyboard (add in /home/xxx/.bashrc)               |
 ------------------------------------------------------------
export LC_CTYPE=el_GR.UTF-8
setxkbmap us,el -variant ,polytonic -option grp:ctrl_shift_toggle -option grp_led:scroll

 or, for single-accent keyboard,

setxkbmap us,el -option grp:ctrl_shift_toggle -option grp_led:scroll

(ctrl/shift changes language selection, scroll lock LED lights when Helenic layout is activated)


Optimization
Start the 
PCLinuxOS Control Center -> System -> Manage system
services; uncheck all services that are not needed on boot (read the relevant information)
for example:
  avahi-daemon, lisa, netfs,
smb
PCLinuxOS Control Center -> System -> Manage system

Remove programs that start daemons, if not used:

apache http server (starts httpd) etc.
update-notifier

Check the net for: reducing improving boot time +linux

GNOME Desktop Autostart

The way to have applications starting automagically under gnome is to have corresponding .desktop files in the autostart directory:

- create the autostart directory under .config in your homee if it doesn't exist

mkdir ~/.config/autostart

- create an application launcher on your desktop; following is an example for the gkrellm system monitoring program :

Right click on the desktop -> Create launcher... -> Type Application, Name: gkrellm, Description: System Monitor, Command: /usr/bin/gkrellm

- copy the resulting gkrellm.desktop to the autostart directory

cp ~/Desktop/gkrellm.desktop ~/.config/autostart

Following are the contents of the gkrellm.desktop file:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=gkrellm
Name[en_US]=gkrellm
Exec=/usr/bin/gkrellm
Name=gkrellm
Icon=gkrellm

For more information on .desktop files, see

http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-0.9.3.html

Firefox - disable uninitiated and unintended requests

This information, with some variation, comes from:

http://blog.kapsobor.de/archives/2008/07/26/deactivating_firefox3_behind-the-curtain_requests/)

Type about:config in the browser's URL field and set/verify the following variables (arranged alphabetically):

app.update.enabled false

breakpad.reportURL http://localhost
browser.safebrowsing.enabled false
browser.safebrowsing.malware.enabled false

browser.search.suggest.enabled false
browser.search.update false

browser.send_pings false
browser.send_pings.require_same_host true

browser.ssl_override_behavior 
(check http://kb.mozillazine.org/Browser.ssl_override_behavior
and make sure you understand what you put in this field.
I would leave the default behavior alone because I have seen cases
of man-in-the-middle attacks by hotel providers) extensions.blocklist.enabled false extensions.update.enabled false keyword.enabled false network.http.sendRefererHeader (0) network.prefetch-next false

Edit /usr/lib/firefox-xx/application.ini, to disable crash reporter :

[Crash Reporter]
Enabled=0

or rename /usr/lib/firefox-xx/crashreporter to disable_crashreporter

Allow desktop access to other local users

If you get a “connection to `0:0` refused by server” error, you can enable access to your desktop by using the following commands (for specific users, for all):

xhost + local:root
xhost + local:

Decode/encode base64 files

In addition to its use as secure server and client, openssl can be used for encoding, decoding, ciphering, and deciphering files. Here is an example for decoding an e-mail message attachment encoded as base64 (ASCII text).

# copy and paste the base64-encoded attachment in attachment.b64
openssl enc -d -base64 -in attachment.b64 -out original_file

# encoding
openssl enc -base64 -in original_file -out attachment.b64

Wireless adapters – ndiswrapper

Wireless adapter firmware binaries should already be installed

modprobe -r ndiswrapper
modprobe ndiswrapper
wpa_supplicant -i wlan0 -D wext -c/etc/wpa_supplicant.conf -B

netgear WiFi card

ifdown eth2
modprobe -r ndiswrapper
modprobe -r prism54
modprobe ndiswrapper if_name=eth%d
dmesg
wpa_supplicant -i eth2 -D wext -c/etc/wpa_supplicant.conf -B
ifup eth2
ifconfig
iwconfig
dmesg
ndiswrapper -v

Camera access

Big brother is here; see what he sees. If nothing works, you can run a vnc server on the camera/video server and access it via a corresponding client. Use motion on a directly-connected camera to create and save snapshots and time-lapse videos.

OV511 USB camera

This is for the Creative pd0040 webcam. Make sure “load v4l” is included in your X configuration file.

rmmod ov511
rmmod ovcamchip
insmod ovcamchip
insmod ov511 debug=0 mirror=0  backlight=0 led=0 autobright=1 autoexp=1 force_palette=15

# http://www.rastageeks.org/downloads/ov51x-jpeg/
rmmod ov511
rmmod ovcamchip
rmmod ov51x-jpeg
insmod /home/xxx/packages/ov51x-jpeg-1.5.9/ov51x-jpeg.ko debug=0 mirror=0  backlight=0 led=0 autobright=1 autoexp=1 force_palette=15

HTML page to access a camera

<HTML>
<IMG SRC=http://192.168.0.xxx:9192>
</HTML>

Picture from FTP server

Downloads a picture to a temporary file; as soon as the transfer is complete the file is copied to the file which is eventually displayed.

# dmftp is a script to get a file in lastsnap.jpg
if (test -z $1); then
  echo "Usage: dmftp url"
else
  ftp $1 -o temp.jpg
  cp temp.jpg lastsnap.jpg
  rm temp.jpg
fi

AV Tech

# snapshot: needs login with captcha
192.168.0.xxx/snapshot.html

# stream, after several seconds, vlc works, mplayer does not work
ffmpeg rtsp://admin:admin@192.168.0.xxx/live/h264

# snapshot
http://192.168.0.xxx/cgi-bin/guest/Video.cgi?media=JPEG

# vlc works here, too
http://192.168.0.xxx/cgi-bin/guest/Video.cgi?media=MJPEG

Vivotek IP7135 3GPP IP Network Camera

# stream
mplayer rtsp://user:password@192.168.0.xxx:554/live.sdp
# or 
ffplay rtsp://user:password@192.168.0.xxx:554/live.sdp

# snapshot
http://user:password@192.168.0.xxx/snapshot.html
http://192.168.0.xxx/cgi-bin/video.jpg

# also
/cgi-bin/sysinfo.cgi
/cgi-bin/camctrl.cgi
/cgi-bin/control.cgi

Midnight Commander file manager – zip file issue

The Midnight Commander (mc) file manager is fashioned after the Norton Commander (nc) of old, with the addition of Unix-specific file operations. Archives are opened as a virtual directory and file operations are possible. Lately, I encountered a problem with my distribution – could not open .zip archives. I resolved it by changing the corresponding entry in the system-wide extensions file (/etc/mc/mc.ext) F9 → Command → Edit Extension file (System-wide).

# zip
#type/^([Zz][Ii][Pp])\ archive
regex/\.([Zz][Ii][Pp])
        Open=%cd %p#uzip
        View=%view{ascii} unzip -v %f

Find files modified today

find . -mtime -1 \! -type d -exec ls -l {} \;

Formatted table of contents

Prints month, day, filename; ls format may change again; columns may need to be adjusted.

ls -lt | colrm 39 43 | colrm 1 30

Floppy disk directory listing

mount $1 -r -t msdos -o loop /media/floppy
ls -lR /floppy

CD disk directory listing

mount $1 -r -t iso9660 -o loop ./mnt
ls -lR ./mnt

CD Directory tree

A script to create a directory tree of your CDs based on find and sed. If hwinfo is available, volume information is included.

# cdtree: Directory tree view
#
# usage: cdtree [directory] [directory_depth]
#
# -- the default directory is /media/cdrom
# -- the default directory depth is 2
# -- directories ending in _files (Mozilla web page saves) are not printed
# -- to make a CD cover:  cdtree [options] > dirtext.txt
#    import dirtext.txt into OpenOffice; 
#    use Bitstream Vera Sans, 7.5pt, 
#    2 columns, 6 cm each, column break around 11cm
#
if (test -z $1) then
    DIR="/media/cdrom"
else
    DIR=$1
fi
if (test -z $2) then
    DEPTH=2
else
    DEPTH=$2
fi

# Original one-liner:
#    find $DIR -type d -print | sed -e 's;[^/]*/;|____;g ;s;____|; |;g'

mount /media/cdrom

hwinfo --cdrom |grep "Volume ID:"
hwinfo --cdrom |grep "Creation date:"
find $DIR -mindepth 1 -maxdepth $DEPTH -type d -not -iname '*_files' -print | sed -e 's;[^/]*/;|____;g ;s;____|;    |;g ;s; | ;   ;g'
echo ' \'
find $DIR -maxdepth 1 -not -type d -not -iname 'TRANS.TBL' -print | sed -e 's;[^/]*/; ;g'

Change directory – file mode

If you accidentally locked yourself out of a bunch of directories as a result of chmod -x *, this is for you. It will reset the execute bit for directories, only, allowing re-enty. -c lists the changes made.

find . -type d -exec -c chmod 755 {} \;

and this is a rational way of removing the execute bit from a bunch of files coming from alien systems.

find . -type f -exec chmod 644 {} \;

Change file date and time

touch --date="2010-09-23 09:08" some_file(s)

PCTel modem

PCTel PCI modems make nice fax machines and/or call loggers. The modem initialization settings for the minicom.cid file should read

AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 #CID=1

and this is the script to start the call logger/fax machine; check dmesg to find out the modem device (e.g. /dev/ttyS15).

/sbin/modprobe linmodem
/sbin/modprobe pctel
/sbin/modprobe pctel-hw
minicom -C minicom.cap cid

Older kernels; if you are building the package you may need to remove -Werror from CFLAGS in the Makefile.

# kernel 2.4
DRIVER_DIR=/home/packages/pctel/pctel-0.9.7-9/driver
rmmod ptserial
rmmod pctel
insmod -f $DRIVER_DIR/pctel.o
insmod -f $DRIVER_DIR/ptserial.o
minicom -C minicom.cap cid

Remove control characters from files

# Remove control characters from .c and .h files, 
# create clean files named .c.col or .h.col
for f in `ls *.c`; do cat $f | col > $f.col; done
for f in `ls *.h`; do cat $f | col > $f.col; done

Poor man's concordance

Prints out a sorted list of the words found in a (text) file, along with the number of occurences.

tr '[:blank:][:punct:][:digit:]"' '\n' < $1 | sort -f |uniq -ic

Count lines and words

# count lines in *.c and *.h files
wc -l `find . -name "*.[ch]"`



# Count words in .doc files
for f in *; do  wvText $f | wc -w ; done

Convert .doc files to .txt

for f in *; do  wvText $f > $f.txt ; done 

Convert openoffice files to text

o3totxt is part of the o3read package by Ulric Eriksson: http://siag.nu/pub/o3read/

unzip -p  '$1' content.xml | o3totxt

Remove zero bytes from the input file

Certain programs, including gatesware registry files, use a 16-bit character encoding with the most significant part always being zero. By removing zero bytes, the files become readable as text files.

sed -n '1~1s/\x00//g;1~1p' $1

Remove empty paragraphs

another sed application

# This script will remove "almost empty paragraphs" 
# (space followed by CR/LF) from the input file
sed -n '1~1{
    N
    N
    N
    N
    s/\x0D\x0A \x0D\x0A/\x0D\x0A/g
};
1~1p' $1

Find ASCII files

find . -type f -exec file '{}' \; |grep ASCII

Convert filenames from one encoding to another

Get convmv; read http://www.j3e.de/linux/convmv/man/ (listed in freecode.com)

Perl program to convert gatesware filenames

e.g. ΦÏλ.pdf

# Test
./convmv -f utf8 -t iso-8859-1 --nosmart *

Actual conversion
# ./convmv -f utf8 -t iso-8859-1 --nosmart --notest *

To convert hellenic gatesware filenames to UTF-8:

convmv [-i] -f cp1253 -t utf-8 gatesware_hellenic_filename

The program also supports MacGreek and DOS code pages

Change filenames to lower case

for f in *; do  mv $f `echo $f | tr '[A-Z]' '[a-z]'`; done

Change filenames to upper case

for f in *; do mv $f `echo $f | tr '[a-z]' '[A-Z]'` ; done

Crypto file system

Encrypt one or more partitions, files, or entire disks to protect against unintended information disclosure.

Create an encrypted file system. The example uses twofish encryption to encrypt the third partition of sdb, oblueterating all colorful items in the process.

modprobe cryptoloop
losetup -e twofish256 /dev/loop2 /dev/sdb3
Password: xxxxxxxxxxxxxxxxxxxxx
mkfs.ext3 /dev/loop2

Mount the encrypted file system to /mnt

modprobe cryptoloop
mount /dev/sdb3 /mnt -o rw,loop,encryption=twofish256,noatime,exec

The above process can be used with files or whole disks; the cryptoloop module can be loaded automatically by including it in /etc/modprobe.preload

Compare directories

# ddiff: compare two directories (optionally excluding files that match a specific pattern)
# ddiff directory1 directory2 [pattern_to_exclude]
# 100326 dm
if (test -z $3); then
    diff -r $1 $2
else
    diff -r -x "$3" $1 $2
fi

Compare directory structures (file systems)

...of course you can use kdiff3 or some other nice GUI tool.

# ddiff-a: compare directory structures
# working files are created in the first directory specified 
# 100326 dm
#
if (test -z $1 -o -z $2); then
    echo "USAGE: dddiff top_level_directory_1 top_level_directory_2"
    echo "       output in top_level_directory_1/ddiff.log"
else
    logfile="ddiff_"`date +%y%m%d_%H%M%S`".log"
    if (test -e "$1/$logfile"); then
        echo "ddiff-a: appending to existing log file: $logfile"
    else
        echo "ddiff-a: appending to log file: $logfile"
    fi

    echo -e "\n$logfile\n" &>> $1/$logfile

    # look for directories only existing in the second set
    # as these will not be checked by diff

    echo -e "======= DIRECTORIES ONLY IN $2 ==============\n" &>> $1/$logfile
    ls -p $1 | grep / > $1/ddiff_tmp1
    ls -p $2 | grep / > $1/ddiff_tmp2
    diff $1/ddiff_tmp1 $1/ddiff_tmp2 | grep \> &>> $1/$logfile
    rm -f $1/ddiff_tmp1 $1/ddiff_tmp2

    cd $1
    echo -e "\n======= COMPARING $1 TO $2 ==============\n" &>> $1/$logfile
    for f in *; do
        if (test -d "$f"); then
            echo "ddiff-a: comparing $f"
            nice -n 19 diff -rq "$1/$f" "$2/$f" &>> $1/$logfile
        fi
    done
fi

Video conversions

Sony Ericsson W302

ffmpeg -i "$1" -s 176x144 -vcodec mpeg4 -acodec libfaac -ac 2 -ar 44100 -r 20 "$2"

Playing and dumping ASX files

mplayer -playlist someASXlink.asp

If you want to keep the stream, assuming you have found how it is called

mplayer -dumpstream  
"mms://article_title&opts" -dumpfile dumped.asf

Use a computer as a gateway to the Internet

Portable computer has WiFi access to the Internet through eth0, and is used as a gateway for an “internal” network connected through eth1.

iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward 

Deploy a system on a bunch of new computers

http://tlgu.carmen.gr/gnulinuxtips/The%20glucopy-glurestore%20system%20deployment%20scripts.html

Search files for a pattern

The idea is to convert non-text files to text, using your favorite converters, and then look inside. For pdf files, you can use pdfgrep instead.

# grepin pattern
echo "------- Searching in doc files -------"
for i in `find . -iname \*\.doc`; do
  echo '$i'
  antiword '$i' > test.txt
  grep '$1' test.txt
done
echo "------- Searching in od* files -------"
find . -iname "*.od*" -print -exec ls '{}' \; -exec echo '{}' \; -exec odt2txt --output=test.txt '{}' \; -exec grep '$1' test.txt \;
echo "------- Searching in pdf files -------"
find . -iname "*.pdf" -print -exec ls '{}' \; -exec echo '{}' \; -exec pdftotext '{}' test.txt \; -exec grep '$1' test.txt \;
find . -name test.txt -exec rm test.txt \;

Inter-process communications (IPC)

# ipcstat
ipcs -m -t
ipcs -m -c
ipcs -m -l
ipcs -m -u
ipcs -m -p
ipcs -q -t
ipcs -q -c
ipcs -q -l
ipcs -q -u
ipcs -q -p
ipcs -s -t
ipcs -s -c
ipcs -s -l
ipcs -s -u
ipcs -s -p

Image and pdf conversions

ImageMagick, gs

Image to pdf

convert -contrast -contrast -resample 150x150 *.jpeg output.pdf

pdf to png to pdf

This script converts a bunch of pdf files to png. The files are converted back to pdf, this time with a .gif image as a background (“uncontrolled copy”).

for f in *.pdf; do 
    echo $f
    pdftoppm -png -r 300  $f `echo $f | cut -f1,2 -d'.'`
done

for f in *.png; do
    echo $f
    composite -compose bumpmap -gravity center \( uncontrolled\ copy.gif -resize 300% \) $f `echo $f | cut -f1 -d'-'`.unc.pdf
done

… or the text is inserted by convert.

for f in *.png; do
    convert "$f" -font "DejaVu-Sans-Bold" -pointsize 300 -draw "gravity north fill black text 100,100 'Uncontrolled copy' fill gray94 text 100,95 'Uncontrolled copy' " "$f.unc.png"
done

Join pdf files

The example is from Linux Device Drivers (LDD)

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=ldd3.pdf TITLE.pdf COPYRIGHT.pdf ldr3TOC.fm.pdf ch00.pdf ch01.pdf ch02.pdf ch03.pdf ch04.pdf ch05.pdf ch06.pdf ch07.pdf ch08.pdf ch09.pdf ch10.pdf ch11.pdf ch12.pdf ch13.pdf ch14.pdf ch15.pdf ch16.pdf ch17.pdf ch18.pdf ldr3IX.fm.pdf AUTHOR.COLO.pdf

plt to dxf to png

HP-GL (HPGL, PLT) plot files (e.g. generated by Orcad) can be converted to various vector and bitmap formats with hp2xx.

Download from http://www.gnu.org/software/hp2xx/. Two examples for converting a plot file to dxf and png (300 dpi resolution) are provided below:

hp2xx -m dxf file.plt
hp2xx -m png -d 300 file.plt

Infra-red port (Toshiba Satellite 1800)

# irstart
# This script will insert the irda drivers
# after removing the parport driver (irq 7)
# parport will be reinstated in polling operation
#modprobe -r lp
#modprobe -r parport_pc
#modprobe -r parport

# Enable the SMC chip handling (deprecated)
#tosh1800-smcinit -i 3 -m 1

#modprobe /lib/modules/`uname -r`/kernel/drivers/net/irda/smsc_ircc2.ko
modprobe smsc_ircc2
modprobe ircomm_tty
irattach irda0 -s

# restart parport (in polled mode)
#modprobe parport



# irstop
# This script will remove the irda drivers (inserted by irstart)
# and will reinstate the parallel port driver (irq 7)
modprobe -r irtty_sir
modprobe -r sir_dev
modprobe -r ircomm_tty
modprobe -r ircomm
modprobe -r smsc_ircc2
modprobe -r irda
modprobe -r crc_ccitt
# remove parport in polled operation, use it with irq 7
#modprobe -r lp
#modprobe -r parport_pc
#modprobe -r parport
#modprobe lp

Port settings for the T300 phone

# irda parameters for T300 (Sony Ericsson)
echo 115200 > /proc/sys/net/irda/max_baud_rate
echo 2000 > /proc/sys/net/irda/max_tx_data_size
echo 1000 > /proc/sys/net/irda/min_tx_turn_time
echo 1 > /proc/sys/net/irda/max_tx_window

kermit script for the T300 mobile phone using the infra-red port

kermit
set carrier-watch off
set line /dev/ircomm0
set speed 115200
connect

GPRS info for various networks, Linux

By Ross Barkman, Mikko Rapeli;

http://www.taniwha.org.uk/gprs.html
http://mcfrisk.kapsi.fi/linux_gprs.html

Print using gs

Back when we didn't have CUPS, printing was done using gs. This is a collection of commands used with StarOffice or stand-alone for printing to corresponding printer models, as indicated by the DEVICE command.

650c

gs -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -r300x300 -sDEVICE=dnj650c -dBitsPerPixel=3 -sOutputFile=test.out $1

690, 690C

gs -sDEVICE=DJ6xxP -dBATCH -dNOPROMPT -dNOPAUSE -dSAFER -sPAPERSIZE=a4 -dQuality=1 -sOutputFile=/dev/lp0 $1
gs -sDEVICE=DJ6xxP -dBATCH -dNOPROMPT -dNOPAUSE -dSAFER -sPAPERSIZE=a4 -dQuality=2 -dColorMode=2 -dMediaType=2 -dPenSet=4 -sOutputFile=/dev/lp0 $1

1100 A3

The printer is installed on a gatesware computer; access is effected using smbclient.

# Usage: printps postscript_file
# Will format and print a text file to your favorite line printer using gs
# Take a look at gs options
#
if (test -z $1 ); then
    echo Usage: print1100 postscript_file
else
    gs -q -dBATCH -sPAPERSIZE=a3 -sDEVICE=hpdj -sColorMode=CMY+K -dNOPAUSE -sOutputFile=print.prn $1      
    smbclient //xxxxx/"hp deskjet 1" -N -c "print print.prn" 
    rm print.prn
fi

1100 A4

# Usage: printps postscript_file
# Will format and print a text file to your favorite line printer using gs
# Take a look at gs options
#
if (test -z $1 ); then
    echo Usage: print1100 postscript_file
else
    gs -sPrintQuality=draft -qF -dBATCH -sPAPERSIZE=a4 -sDEVICE=cdj850 -sColorMode=CMY+K -dNOPAUSE -sOutputFile=print.prn $1
    smbclient //xxxxx/"hp deskjet 1" -N -c "print print.prn" 
    rm print.prn
fi

1100 A3 draft

# Usage: printps postscript_file
# Will format and print a text file to your favorite line printer using gs
# Take a look at gs options
#
if (test -z $1 ); then
    echo Usage: print1100 postscript_file
else
    gs -q -dBATCH -sPAPERSIZE=a3 -sDEVICE=hpdj -sColorMode=CMY+K -sPrintQuality=draft -dNOPAUSE -sOutputFile=print.prn $1      
    smbclient //xxxxx/"hp deskjet 1" -N -c "print print.prn" 
    rm print.prn
fi

cdj850

# Usage: printps postscript_file
# Will format and print a text file to your favorite line printer using gs
# Take a look at gs options
#
if (test -z $1 ); then
    echo Usage: printps postscript_file
else

    gs -q -dBATCH -sPAPERSIZE=a4 -sDEVICE=cdj850 -r150 -dBitsPerPixel=32 -dNOPAUSE -sOutputFile=print.prn $1
    lpr print.prn
    rm print.prn
fi

Completely overwrite and delete files

CAREFUL WITH THAT AXE, EUGENE!

shred is a nice program for completely erasing information from a rewritable medium (rm just unlinks the file, leaving all content on disk). This script will repeatedly execute the shred command on every subdirectory.

find . -type f -execdir shred -u '{}' \;

Completely overwrite 720kb floppy

dd if=/dev/zero of=/dev/fd0 bs=512 count=1440
mformat -f 720 a:
echo -e "\a"
echo -e "\a"
echo -e "\a"

Completely overwrite 1.4Mb floppy

dd if=/dev/zero of=/dev/fd0 bs=512 count=2880
mformat a:
echo -e "\a"
echo -e "\a"
echo -e "\a"

Completely overwrite device, USB etc.

To clean your storage device so that files are no longer recoverable, use shred on the device.

CAREFUL WITH THAT BIG AXE, EUGENE!



shred /dev/sdxx

Collect system information

System-specific information is collected for configuration management and licensing purposes. This script is for a computer equipped with specific adapters. Modify, as required. dmidecode makes BIOS data readable.

# Collect system information - status
#
echo -e "\nSYSTEM INFORMATION"
#su
cat /proc/cmdline
cat /proc/meminfo | grep MemTotal
cat /proc/cpuinfo | egrep '(processor|model\ name|MHz)'

echo -e "\nSYSTEM EQUIPMENT"
lspci -v

echo -e "\nXorg INFORMATION"
cat /var/log/Xorg.0.log | egrep '(\(WW\)|\(EE\)|LoadModule:|Chipset:|: Output|EDID)'

echo -e "\nDRIVES"
hdparm -i /dev/sda
hdparm -i /dev/sdb
hdparm -i /dev/sr0

echo -e "\nETHERNET ADAPTER(S)"
ifconfig

echo -e "\neth0"
ethtool eth0 | egrep '(Speed:|Duplex:|Port:|Link)'
ethtool -i eth0

echo -e "\neth0"
ethtool eth1 | egrep '(Speed:|Duplex:|Port:|Link)'
ethtool -i eth1

echo -e "\nDIGI ADAPTER"
cat /proc/dgap/0/vpd
cat /proc/dgap/0/info
cat /proc/dgap/0/flags

echo -e "\nRAID ARRAY STATUS"
cat /proc/mdstat

echo -e "\nBIOS INFO"
dd if=/dev/mem bs=1k skip=768 count=256 2>/dev/null | strings -n 15
echo -e "\n-----------------------\n"
dmidecode
echo -e "\n---------END-----------\n"

Use a CDRW with GRUB

kernel /vmlinuz root=/dev/hda1 hdb=ide-scsi

GRUB examples

Find a boot partition, setup boot, restore.

Manual setup/boot:
find /boot/grub/stage1 (to find partition)
root (hd0,1) (was found at first hdd, second partition)

#for setting up
setup(hd0) (MBR)
quit (necessary, to flush everything)

#for booting
kernel /vmlinuz root=/dev/sda2 (kernel parameters)
initrd /initrd
boot 
-----------------------------------------------------
For the restore script:

#!/bin/sh
/sbin/grub --batch <<EOT
root(hd0,1)
setup(hd0)
quit
EOF

UPS

/usr/local/ups/bin/upsdrvctl -u ups start
/usr/local/ups/sbin/upsd -u ups
/usr/local/ups/sbin/upsmon -u ups
/usr/local/ups/bin/upsc active

# /usr/local/ups/etc holds ups configuration
# add uucp group to user ups
# PATH=$PATH:/usr/local/ups/bin:/usr/local/ups/sbin

Vesta UPS

# ups-start
# Script to start the nut ups driver/daemon monitor
# 071114 dm
#
DRIVERPATH=/usr/local/ups/bin
killall /usr/local/ups/sbin/upsmon
#killall /usr/local/ups/sbin/upsd
#killall /usr/local/ups/bin/megatec
chmod 666 /dev/ttyS*
/usr/local/ups/bin/upsdrvctl -u nut start vesta
/usr/local/ups/sbin/upsd -u nut
/usr/local/ups/sbin/upsmon -u nut
/usr/local/ups/bin/upsc vesta@localhost

Chloride UPS

071108 dm

Make sure the ups is connected to your computer using the serial cable.

login as root

Insert MopUPS CD

Change to the CD's mountpoint:

cd /media/mopups271

sh install.unix.sh

> Please enter your product key:

The product key is on the back of the CD case (OEM CD License key)

2882-125541-00002

> Please tell me your GLIBC version.

Check by issuing the following command (usually both versions are installed):

ls /usr/lib/libglib*

...
> Starting MopUPS service.

The program is installed in /opt/mopups and a package entry is created; the running daemon (ps aux) is listed as

/opt/mopups/bin/mopupsd start


The UPS application needs to be configured.

/opt/mopups/bin/setup


If it segfaults after language selection, e.g.
/opt/mopups/bin/setup: line 719: 24996 Segmentation fault      (core dumped) $MOPUPS -n -e "quiet open $HOST" >/dev/null

edit the /opt/mopups/bin/setup script and change the following line
from
DEFAULTHOST=localhost
to
DEFAULTHOST=127.0.0.1

and rerun; choose password, advanced signalling, Active UPS, serial port: /dev/ttyS0 (or /dev/ttyS1 or whatever), nominal AC voltage (230 VAC) 

Now you can start the monitoring facility:

mopups 127.0.0.1 (or whatever address the daemon is running on)

Useful commands:

ups status (current status and messages)
ups ident (identification)
ups test (e.g. QuickBatteryTest)
ups get all

event set (event, action) - or you can modify the /opt/mopups/etc/mopups.cfg file

exit

References, programming, other

The Linux Programmer's Guide

http://www.ibiblio.org/pub/Linux/docs/linux-doc-project/programmers-guide/lpg-0.4.pdf

Linux Device Drivers, Third Edition by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman

http://lwn.net/images/pdf/LDD3/

ASCII Art

telnet towel.blinkenlights.nl

Saving web pages

Using konqueror, to save a web page, complete with relocated images, use the "Tools/Archive Web Page" selection. This creates a .war file (should read with an open a, like tar, because that's what it is). A .war file can be previewed and opened using konqueror and/or handled using tar tools.

Firefox can save a page (or multiple tabs) as MHT (Mime HTML) format. The UnMHT extension is used to read MHT files.

Multi-serial ports

The dgap driver installation and configuration for the Digi Acceleport Xem series.

# modprobe -r epca
edit /etc/modprobe.d/blacklist -> add "blacklist epca"
# rpm -i /home/ats/Packages/dgap-1.3-16.src.rpm
(results in /usr/src/rpm/SOURCES/dgap-1.3.tgz
# cd /usr/src/rpm/SOURCES
# tar -xvzf dgap-1.3.tgz (creates folder
/usr/src/rpm/SOURCES/dgap-1.3
# cd dgap-1.3
# ./configure
# make all
# make install
# make postinstall
# mpi -> Config -> yes -> yes -> 1 adapter -> 2
AccelePort Xem PCI -> 1 module -> 16 ports -> Yes
(Module Port Names ttya01 - ttya16) -> Yes (altpin off)
-> No (load driver) OK -> Exit MPI

Reboot the machine to reset board and load AccelePort
firmware

# cat /proc/dgap/0/info (verify Board READY)
Note: device nodes are created root:root with 660
permissions; for user access edit /etc/udev/rules.d/10-
dgap.rules and add GROUP and MODE values for tty and
printer devices:
# Build our custom tty names on these events...
KERNEL=="tty_dgap*", PROGRAM="/usr/sbin/dgap_udev %k",
NAME="%c", OPTIONS+="last_rule", GROUP="uucp",
MODE="0666"
KERNEL=="pr_dgap*", PROGRAM="/usr/sbin/dgap_udev %k",
NAME="%c", OPTIONS+="last_rule", GROUP="uucp",
MODE="0666"

epca driver for the DigiBoard Acceleport Xem ISA

DigiBoard Acceleport Xem ISA setup and use
------------------------------------------

Documentation from "access resources" CD
----------------------------------------
xem-xxxx-inst-91000741.pdf (DIP switches - address selection)
xem-xxxx-inst-91000743.pdf (PORTS/8em and PORTS/16em module Hardware
information)
prd_msc_acceleportxem.pdf (product description brief, digi site)

Driver (Linux kernel 2.4 only)
------------------------------
http://ftp1.digi.com/support/driver/40001450.tar.gz
03000239_T.txt (driver release notes)

Untar the file and you will get epca-1.57-1

The contents of the epca-1.57-1 directory must be copied to /usr/src/dg/epca

Build the driver:

cd /usr/src/dg/epca
./configure
make install

Configure the driver:

cd /usr/src/dg/epca/digiConf
./digiConf

No of boards:  1
Board type:    3 (Acceleport Xem ISA)
I/O address:   1 (104x - DIP switches 1-4 must be set as UP-UP-DN-DN)
Shared memory: 7 (d0000x - cat /proc/iomem to make sure it is free)
No of ports:   8 (for one PORTS/8em module)
Altpin:        n (if set to 'y' DSR becomes DTR - for RJ-45 boxes)


Load the driver module and create the device nodes (the script must be
 linked in the rc.d chain):

/etc/init.d/epca start (options are start | stop | restart)

sxbios.bin and sxfep.bin are downloaded to the card.

32 Device nodes created: /dev/ttyD000 to /dev/ttyD031

/dev/ttyD000 to /dev/ttyD007 are used with PORTS/8em


Diagnostics:
-----------
Use /usr/src/dg/epca/dpa (digital port authority) to see individual  
port statuses and do a loopback test with the included loopback plug

cat /proc/epca

/usr/src/dg/epca/ditty (like stty)

Serial printer under KDE

These instructions for setting up a raw (no translation) serial printer are for KDE 3.5 but may be useful elsewhere:

KDE Control Center (Administrator Mode):
Peripherals -> Printers -> Add -> Add Printer/Class
Add Printer Wizard: select Other printer type -> Next
URI: serial:/dev/ttya09?
baud=1200+bits=7+parity=none+flow=hard
-> Next
checkbox: Raw printer (no driver needed) -> Next
-> Next -> skip banner selection (No Banner) -> Next ->
skip quota selection (No quota, none, none) -> Next
define allowed/denied users -> Next
enter printer name: printer -> Next

After the printer appears on the printer list, right click and define as local default and as user default.
The printer name will appear in bold and italics, e.g. printer
Make sure that the printer is started
(right click, Start printer)

How to print a text file to the default printer:
Run kprinter (ALT/F2, kprinter) or select the text file with the mouse and drop it in the Printer icon (drag and drop).

The "KPrinter" form opens up. Select Print.
A Warning form opens up. Select Keep (No conversion)

Terratec sound card

This is for the 24/96 Terratec PCI card. The digital audio CD output connects directly to the card's S/PDIF input. Use envy24control for mixer. To hear the CD output you must set in Patchbay / Router of envy24control: S/PDIF In L – H/W Out 1, S/PDIF In R – H/W Out 2. Analog Volume DAC 0 – DAC 1.

Use gramofile, audacity, ecawave for recording / editing.

Hellenic Polytonic keyboard

export LC_CTYPE=el_GR.UTF-8
setxkbmap us,el -variant ,polytonic -option grp:ctrl_shift_toggle -option grp_led:scroll

Check out http://tlgu.carmen.gr/Hellenic_polytonic_HOWTO.html.

Run from flash (ramdisk)

Programs can be run from flash. In order not to burden the flash with useless re-writes, transient information is stored in RAM. This is one way to do it (commands are executed as a level 3 command when the computer starts.

# must be run at level 3 (with network)
# 27-May-2005 dm
#
# A ramdisk is created and temporary files are moved there
#
echo "Starting xxxxx ======================================"
umount -n /dev/ramdisk
mke2fs -b 1024 -m 0 /dev/ramdisk

rm -rf /tmp
rm -rf /var/log
rm -rf /var/log/cache

mount -n /dev/ramdisk /ram
mkdir -p /ram/{log,tmp}
chmod ugo+rwx,o+t /ram/tmp

mkdir -p /ram/var/log

ln -s /ram/var/log /var/log
ln -s /ram/var/log/cache /var/log/cache
ln -s /ram/tmp /tmp

Stop logging to save space; edit /etc/syslog.conf or disable syslogd and klogd. Check the manual (man syslogd, man klogd).

/usr/sbin/syslogd -m 0
/usr/sbin/klogd -c 3 -x

GNU Free Documentation License

Version 1.2, November 2002

Copyright (C) 2000,2001,2002  Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

0. PREAMBLE

The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

1. APPLICABILITY AND DEFINITIONS

This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.

A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.

The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.

A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque".

Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.

The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.

A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition.

The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.

2. VERBATIM COPYING

You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

You may also lend copies, under the same conditions stated above, and you may publicly display copies.

3. COPYING IN QUANTITY

If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

4. MODIFICATIONS

You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.

B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.

C. State on the Title page the name of the publisher of the Modified Version, as the publisher.

D. Preserve all the copyright notices of the Document.

E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.

F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.

G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.

H. Include an unaltered copy of this License.

I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.

J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.

K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.

L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.

M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version.

N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section.

O. Preserve any Warranty Disclaimers.

If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.

You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

5. COMBINING DOCUMENTS

You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.

The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements."

6. COLLECTIONS OF DOCUMENTS

You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

7. AGGREGATION WITH INDEPENDENT WORKS

A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.

If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.

8. TRANSLATION

Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.

If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.

9. TERMINATION

You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

10. FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.



How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.



You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.



Linux Floobydust.111215 Page 9 of 48